1. Field of the Invention
The present invention relates to a portable electronic device such as an IC card which incorporates a module having a nonvolatile memory capable of data write and rewrite and a control element such as a CPU, and executes processing corresponding to an externally input command.
2. Description of the Related Art
A conventional example of a portable electronic device is an IC card which is formed by embedding an IC module having functions of, e.g., a memory and a CPU in a shell in the form of a plastic card. Such an IC card writes data in a rewritable nonvolatile memory or reads data from it in accordance with a command from an external device. The IC cards are used in various fields such as access control, credit card, cellular phone, and electronic commerce from the viewpoint of the importance of security. In many recent operation forms, one IC card is used for various kinds of application purposes by running a plurality of applications.
In general, data exchange between an IC card and a host device (terminal) is performed via a “channel for communication” which is called a logical channel. In a general operation form, since an IC card and a terminal conventionally perform one-to-one communication, processing is completed using only one channel. However, in many recent cases, one IC card communicates with a plurality of terminals. This has occurred because the basic performance of IC cards has improved, or IC cards having a plurality of interfaces (e.g., contact type, noncontact type, or high-speed contact type) to external devices are growing in number. To communicate with a plurality of terminals, an IC card sets up a plurality of channels and controls to make each channel access its target file (or application).
However, in the current IC card, access to a file is managed not for each of the plurality of channels. That is, the conventional IC card can unconditionally access a file via the plurality of channels. If unconditional access from the plurality of channels to each file is possible, various problems arise in the IC card. For example, a file which is being accessed via a first channel may be rewritten via a second channel. Such a phenomenon makes it impossible to implement processing expected in the first channel.